using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using TimeTableManagement.Entities;

namespace TimeTableManagement.Mapping
{
	public class Tb_Assign_CourseMap : EntityTypeConfiguration<Tb_Assign_Course>
	{
		public Tb_Assign_CourseMap()
		{
			// Primary Key
			this.HasKey(t => t.id);

			// Properties
			// Table & Column Mappings
			this.ToTable("Tb_Assign_Course");
			this.Property(t => t.id).HasColumnName("id");
			this.Property(t => t.id_lecturer).HasColumnName("id_lecturer");
			this.Property(t => t.id_course).HasColumnName("id_course");
			this.Property(t => t.rate).HasColumnName("rate");
			this.Property(t => t.status).HasColumnName("status");

			// Relationships
			this.HasRequired(t => t.Tb_People)
				.WithMany(t => t.Tb_Assign_Course)
				.HasForeignKey(d => d.id_lecturer);
				
		}
	}
}

